package cn.tanghom.app.oa.service.impl;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


import cn.tanghom.app.oa.model.Talent;
import cn.tanghom.app.oa.repository.EduExpRepository;
import cn.tanghom.app.oa.repository.ProjectExpRepository;
import cn.tanghom.app.oa.repository.TalentRepository;
import cn.tanghom.app.oa.repository.WorkExpRepository;
import cn.tanghom.app.oa.service.ResumeService;

@Service("resumeService")
public class ResumeServiceImpl implements ResumeService {
	

	@Autowired
	TalentRepository resumeRepository;
	
	@Autowired
	WorkExpRepository workExpRepository;	
	
	@Autowired
	EduExpRepository eduExpRepository;
	
	@Autowired
	ProjectExpRepository projectExpRepository;	
	

	@Override
	public Talent getResume(String source, Long id) {
		// TODO Auto-generated method stub
		Talent resume = resumeRepository.findOne(id);		
		resume.works = workExpRepository.findByResumeId(resume.getResumeId());
		resume.edus = eduExpRepository.findByResumeId(resume.getResumeId());
		resume.projects = projectExpRepository.findByResumeId(resume.getResumeId());
		return resume;	
	}

	@Override
	public boolean updateResume(String source, Talent a) {
		// TODO Auto-generated method stub
		resumeRepository.save(a);
		return true;
	}

	@Override
	public List<Talent> findResume(String source, Map<String, String> query) {
		// TODO Auto-generated method stub
		return null;
	}

}
